<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="myclock"></div>
    <script>
        function disptime() {
            var today = new Date();
            var year = today.getFullYear();
            var month = today.getMonth() + 1;
            var datexx = today.getDate();
            var hh = today.getHours();
            var mm = today.getMinutes();
            var ss = today.getSeconds();
            var mise = today.getTime();
            document.getElementById("myclock").innerHTML = "现在是:" + year + "-" + month + '-' + datexx + " "+ hh + ":" + mm + ": " + ss + '毫秒：'+mise;


        }
        setInterval(disptime, 1000);
        // disptime();//执行一次
    </script>
</body>

</html>